xm: allow non-existent readline module
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 18 Mar 2008 11:32:06 +0000 (11:32 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 18 Mar 2008 11:32:06 +0000 (11:32 +0000)
Let xm work even if Python doesn't have its readline module installed.

Signed-off-by: John Levon <john.levon@sun.com>
tools/python/xen/xm/main.py

index b4e7f1804b3b88a0068672e06e828304145d4d03..eab8e47c632a8693e633acd446408c6fb3ed6058 100644 (file)
@@ -626,8 +626,11 @@ class Shell(cmd.Cmd):
 
     def preloop(self):
         cmd.Cmd.preloop(self)
-        import readline
-        readline.set_completer_delims(' ')
+        try:
+            import readline
+            readline.set_completer_delims(' ')
+        except ImportError:
+            pass
 
     def default(self, line):
         words = shlex.split(line)